home *** CD-ROM | disk | FTP | other *** search
/ BBS in a Box 7 / BBS in a Box - Macintosh - Volume VII (BBS in a Box) (January 1993).iso / Files / Prog / T / Think-Pascal-7.0.cpt / THINK Pascal Interfaces / Aliases.p < prev    next >
Encoding:
Text File  |  1991-04-03  |  4.0 KB  |  128 lines  |  [TEXT/PJMM]

  1. {    This file has been processed by The THINK Pascal Source Converter, v1.1.    }
  2.  
  3. {}
  4. {Created: Monday, January 28, 1991 at 1:26 PM}
  5. {    Aliases.p}
  6. {    Pascal Interface to the Macintosh Libraries}
  7. {}
  8. {        Copyright Apple Computer, Inc.    1989-1990}
  9. {        All rights reserved}
  10. {}
  11.  
  12.  
  13. {$IFC UNDEFINED UsingIncludes}
  14. {$SETC UsingIncludes := 0}
  15. {$ENDC}
  16.  
  17.  
  18. unit Aliases;
  19. interface
  20.     uses
  21.         Types, Dialogs, OSUtils, AppleTalk, Files;
  22.  
  23.  
  24.  
  25.  
  26.  
  27.  
  28.  
  29.  
  30.  
  31.  
  32.  
  33.  
  34.  
  35.  
  36.  
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44.     const
  45.         rAliasType = 'alis';                { Aliases are stored as resources of this type }
  46.  
  47. { define alias resolution action rules mask }
  48.         kARMMountVol = $00000001;           { mount the volume automatically }
  49.         kARMNoUI = $00000002;               { no user interface allowed during resolution }
  50.         kARMMultVols = $00000008;           { search on multiple volumes }
  51.         kARMSearch = $00000100;             { search quickly }
  52.         kARMSearchMore = $00000200;         { search further }
  53.         kARMSearchRelFirst = $00000400;     { search target on a relative path first }
  54.  
  55. { define alias record information types }
  56.         asiZoneName = -3;                   { get zone name }
  57.         asiServerName = -2;                 { get server name }
  58.         asiVolumeName = -1;                 { get volume name }
  59.         asiAliasName = 0;                   { get aliased file/folder/volume name }
  60.         asiParentName = 1;                  { get parent folder name }
  61.  
  62.  
  63.     type
  64. { define the alias record that will be the blackbox for the caller }
  65.         AliasPtr = ^AliasRecord;
  66.         AliasHandle = ^AliasPtr;
  67.         AliasRecord = record
  68.                 userType: OSType;               { appl stored type like creator type }
  69.                 aliasSize: INTEGER;             { alias record size in bytes, for appl usage }
  70.             end;
  71.  
  72.  
  73.         AliasInfoType = INTEGER;            { alias record information type }
  74.         AliasFilterProcPtr = ProcPtr;
  75.  
  76.  
  77. {  create a new alias between fromFile-target and return alias record handle  }
  78.     function NewAlias (fromFile: FSSpecPtr; target: FSSpec; var alias: AliasHandle): OSErr;
  79.     inline
  80.         $7002, $A823;
  81.  
  82. { create a minimal new alias for a target and return alias record handle }
  83.     function NewAliasMinimal (target: FSSpec; var alias: AliasHandle): OSErr;
  84.     inline
  85.         $7008, $A823;
  86.  
  87. { create a minimal new alias from a target fullpath (optional zone and server name) and return alias record handle  }
  88.     function NewAliasMinimalFromFullPath (fullPathLength: INTEGER; fullPath: Ptr; zoneName: Str32; serverName: Str31; var alias: AliasHandle): OSErr;
  89.     inline
  90.         $7009, $A823;
  91.  
  92. { given an alias handle and fromFile, resolve the alias, update the alias record and return aliased filename and wasChanged flag. }
  93.     function ResolveAlias (fromFile: FSSpecPtr; alias: AliasHandle; var target: FSSpec; var wasChanged: BOOLEAN): OSErr;
  94.     inline
  95.         $7003, $A823;
  96.  
  97. { given an alias handle and an index specifying requested alias information type, return the information from alias record as a string. }
  98.     function GetAliasInfo (alias: AliasHandle; index: AliasInfoType; var theString: Str63): OSErr;
  99.     inline
  100.         $7007, $A823;
  101.  
  102. {  given a file spec, return target file spec if input file spec is an alias.}
  103. {    It resolves the entire alias chain or one step of the chain.  It returns}
  104. {    info about whether the target is a folder or file; and whether the input}
  105. {    file spec was an alias or not.}
  106.     function ResolveAliasFile (var theSpec: FSSpec; resolveAliasChains: BOOLEAN; var targetIsFolder: BOOLEAN; var wasAliased: BOOLEAN): OSErr;
  107.     inline
  108.         $700C, $A823;
  109.  
  110. {   Low Level Routines }
  111. {given an alias handle and fromFile, match the alias and return aliased filename(s) and needsUpdate flag}
  112.     function MatchAlias (fromFile: FSSpecPtr; rulesMask: LONGINT; alias: AliasHandle; var aliasCount: INTEGER; aliasList: FSSpecArrayPtr; var needsUpdate: BOOLEAN; aliasFilter: AliasFilterProcPtr; yourDataPtr: univ Ptr): OSErr;
  113.     inline
  114.         $7005, $A823;
  115.  
  116. { given a fromFile-target pair and an alias handle, update the lias record pointed to by alias handle to represent target as the new alias. }
  117.     function UpdateAlias (fromFile: FSSpecPtr; target: FSSpec; alias: AliasHandle; var wasChanged: BOOLEAN): OSErr;
  118.     inline
  119.         $7006, $A823;
  120.  
  121.  
  122.     { UsingAliases }
  123.  
  124.  
  125. implementation
  126. end.
  127.  
  128.